<script setup lang="ts">
import { ref, computed } from "vue";
import { convertStringToNumber } from "@visual/utils";
import ReTextTooltip from "../../../components/ReTextTooltip";

defineOptions({
  name: "middleTip"
});
const props = withDefaults(
  defineProps<{
    propValue?: {
      contentList: Array<any>;
      title?: string;
    };
  }>(),
  {
    propValue: () => ({
      contentList: [],
      title: ""
    })
  }
);
</script>

<template>
  <div class="modpx-wrapper">
    <div class="modpx-title">
      <div v-if="propValue.title" class="flex justify-start items-center mb-[8px] pl-[20px] pr-[20px]">
        <div>
          {{ propValue.title }}
        </div>
      </div>
    </div>
    <px-scrollbar max-height="340px">
      <div class="flex flex-col w-[100%] pr-[20px] pl-[20px]">
        <div v-for="(item, index) in propValue?.contentList" :key="item.tagNum ? item.tagNum : index" class="flex items-center w-[100%] mt-[16px]">
          <!-- <div class="w-[40%] text-[16px] text-[rgba(0,0,0,0.8)] font-normal overflow-ellipsis overflow-hidden whitespace-nowrap">
            {{ item.title }}
          </div> -->
          <div class="w-[150px] text-[14px] text-[rgba(0,0,0,0.8)] font-normal">
            <ReTextTooltip :key="index" :style="{ 'white-space': 'nowrap' }" :content="item.title" />
          </div>

          <div class="w-[50%] flex text-[14px] font-medium">
            <span class="text-[#3B82F6]">{{ convertStringToNumber(item.value) }}</span>
            <span class="text-[rgba(0,0,0,0.8)]">{{ item.unit }}</span>
          </div>
        </div>
      </div>
    </px-scrollbar>
  </div>
</template>

<style lang="scss" scoped>
.modpx-wrapper {
  width: 100%;
  padding: 16px 0 20px;
  margin-bottom: 8px;
  background-color: #fff;
  backdrop-filter: blur(10px);
  border-radius: 8px;
  opacity: 0.75 !important;

  .content-wrapper {
    overflow: hidden;
  }

  .modpx-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    font-size: 18px;
    font-weight: 700;
    line-height: 18px;
    color: #000;
    box-shadow: inset 0 -1px 0 0 rgb(0 0 0 / 10%);
  }
}
</style>
